package com.snow.auth.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.conditions.ConditionType;
import com.snow.conditions.QueryConditionField;
import com.snow.jpa.IBaseEntity;
import com.snow.jpa.ICreateInfoEntity;
import com.snow.jpa.ITenant;
import com.snow.jpa.model.BasePageParams;
import com.snow.jpa.model.IBaseSearchParams;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 系统租户表
 *
 * @author by 13119
 */
@Getter
@Setter
@Entity
public class SystemTenant extends BasePageParams implements ITenant, IBaseEntity<Integer>, ICreateInfoEntity, IBaseSearchParams {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    /**
     * 租户公司名称
     */
    @QueryConditionField(type = ConditionType.like)
    private String companyName;
    /**
     * 租户说明
     */
    private String descript;
    /**
     * 子域名编码
     */
    private String subdomain;
    /**
     * 联系人
     */
    @QueryConditionField(type = ConditionType.like)
    private String name;
    /**
     * 联系人电话
     */
    @QueryConditionField(type = ConditionType.like)
    private String phone;
    private Integer createId;
    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 创建人姓名
     */
    private String createName;
    /**
     * 服务费价格/年
     */
    private BigDecimal servicePrice;
    /**
     * 到期日期
     */
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date expiredDate;
    @Transient
    private boolean expired;
    /**
     * 访问子域名
     */
    @Transient
    private String accessSubdomain;
}
